# Forked from Alpine to add systemd!

pkgname=gnome-shell
pkgver=99947.2
_pkgver=47.2
pkgrel=0
pkgdesc="GNOME shell"
url="https://gitlab.gnome.org/GNOME/gnome-shell"
# gjs -> mozjs
arch="all !armhf !s390x"
license="GPL-2.0-or-later"
depends="
	accountsservice
	adwaita-icon-theme
	desktop-file-utils
	font-adobe-source-code-pro
	font-cantarell
	gnome-bluetooth
	gnome-control-center
	gnome-shell-schemas
	gsettings-desktop-schemas>=46
	gst-plugin-pipewire
	gst-plugins-good
	gstreamer
	ibus
	librsvg
	systemd
	tecla
	unzip
	upower
	"
makedepends="
	asciidoc
	evolution-data-server-dev evolution-dev
	gcr4-dev
	gjs-dev>=1.78.0
	gnome-autoar-dev
	gnome-bluetooth-dev
	gnome-control-center-dev
	gnome-desktop-dev>=44.0
	gobject-introspection-dev
	gstreamer-dev
	ibus-dev
	libcanberra-dev
	libnma-dev
	libxml2-dev
	libxml2-utils
	meson
	mutter-dev>=99947
	networkmanager-dev
	pipewire-dev
	polkit-dev
	pulseaudio-dev
	py3-docutils
	py3-setuptools
	python3
	sassc
	startup-notification-dev
	systemd-dev
	tecla-dev
	"
checkdepends="
	mesa-dri-gallium
	xvfb-run
	"
	# gdm is also needed but introduces circular dep
subpackages="
	$pkgname-dbg
	$pkgname-doc
	$pkgname-lang
	$pkgname-schemas::noarch
	gnome-extensions-app:extensions_app:noarch
	"
source="https://download.gnome.org/sources/gnome-shell/${_pkgver%.*}/gnome-shell-$_pkgver.tar.xz
	gsh.patch
	schemas_req.patch
	"
# TODO: crossdirect disabled due to armv7 crosscompile failure on x86_64, see
# https://gitlab.com/postmarketOS/pmaports/-/merge_requests/5115#note_1899890119
options="!check !pmb:crossdirect" # Tests have circular dependency 'gnome-shell <-> gdm'
builddir="$srcdir/$pkgname-$_pkgver"

# secfixes:
#   0:
#     - CVE-2019-3820

build() {
	abuild-meson \
		-Db_lto=true \
		-Dtests=false \
		. output
	meson compile -C output
}

check() {
	xvfb-run meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

extensions_app() {
	pkgdesc="Manage GNOME Shell extensions"
	depends="gnome-shell libadwaita"
	replaces="gnome-shell"

	amove usr/bin/gnome-extensions-app
	amove usr/share/applications/org.gnome.Extensions.desktop
	amove usr/share/gnome-shell/org.gnome.Extensions
	amove usr/share/gnome-shell/org.gnome.Extensions.data.gresource
	amove usr/share/gnome-shell/org.gnome.Extensions.src.gresource
}

schemas() {
	pkgdesc="GNOME Shell gsetting schemas"
	depends=""
	replaces="gnome-shell"

	amove usr/share/glib-2.0/schemas
	amove usr/share/gnome-control-center/keybindings
}

sha512sums="
85e278f80fea53b13a030eeb2847352726810a43916889fe63e9f65b2920806e6406eb00ecc62bc8915e1f29112dc02059f5ce0e74bcbcb794be03ea191f8ef2  gnome-shell-47.2.tar.xz
ae4ac679bacd35948b44068e5a70407f473bd96986ee126abb1bdf066db5cbc2087a3ffae0b390286689cacbe8325870fd43663ba39f4f7543216e02bf083934  gsh.patch
3fab1a0e141ae7c972e827935c6e4c52d927faf69dd25a5c72bbcdaa1b763d1bb58ea5cb074686145b29c3391f557b01920a8d3613bb83d15f073d661a447426  schemas_req.patch
"
